package com.bangbang.blog.controller;


import com.bangbang.blog.pojo.TbIntegralRunning;
import com.bangbang.blog.service.impl.TbIntegralRunningServiceImpl;
import com.bangbang.configresult.Result;
import com.bangbang.configresult.ResultEnum;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 积分流水表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-12
 */
@RestController
@RequestMapping("/blog/tbIntegralRunning")
public class TbIntegralRunningController {

    @Autowired
    private TbIntegralRunningServiceImpl tbIntegralRunningService;

    //新增

    @PostMapping
    @ApiOperation("积分流水新增方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tbIntegralRunning",value = "积分流水实体类",required = true,paramType = "body")
    })
    public Result insert(@RequestBody TbIntegralRunning tbIntegralRunning){
        tbIntegralRunningService.insert(tbIntegralRunning);
        return Result.buildResult(ResultEnum.SUCCESS);
    }

    //修改
    @PutMapping
    @ApiOperation("积分流水修改方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tbIntegralRunning",value = "积分流水实体类",required = true,paramType = "body")
    })
    public Result update(@RequestBody TbIntegralRunning tbIntegralRunning){
        tbIntegralRunningService.updateById(tbIntegralRunning);
        return Result.buildResult(ResultEnum.SUCCESS);
    }

    //查询
    @GetMapping
    @ApiOperation("积分流水查询方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "runId",value = "积分流水查询方法",required = true,paramType = "query")
    })
    public Result select(@RequestParam(required = true)Long runId){
        tbIntegralRunningService.select(runId);
        return Result.buildResult(ResultEnum.SUCCESS);

    }
}

